<?php
$node_id = $this->get_data('node_id');
$node_nav = m('node')->get_node_nav($this->get_data('node_id'));
$_parent_id = isset($node_nav[1]) ? $node_nav[1]['id'] : false;
$_selected_node_id = isset($node_nav[2]) ? $node_nav[2]['id'] : false;
$page_index = (int) tos_http_get('page');
$page_index = ($page_index <= 0) ? 1 : $page_index;

?>
<div id="left_bar">
<div  class="left_news">
<h1>Latest News</h1>
<?php if ($_parent_id) m('node')->block_menu($_parent_id, $_selected_node_id, 0, 6, 'news')->display();?>
</div>
</div>
<div id="main_bar">
    <div style="margin: 36px;">
        <div id="news">
            <div id="nav"><?php m('node')->block_node_nav($node_id)->display();?></div>
            <?php //m('node')->block_menu($node_id)->display();
            m('news')->block_list()->display();
            ?>
        </div>
        <?php m('html')->block_pagination(array(
            'page_index' => tos_http_get('page'),
            'page_count' => ceil(m('news')->model('news')->get_count() / 5),
            'base_url'   => 'news?page='
        ))->display();?>
    </div>
    
</div>

<div class="clear"></div>
